package com.itheima.user.controller;

import com.itheima.goods.pojo.Address;
import com.itheima.user.service.AddressService;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.*;

import java.util.List;

@RestController
@RequestMapping("/address")
@CrossOrigin
public class AddressController {
    @Autowired
    private AddressService addressService;

    //根据用户名查询到对应的收货地址列表
    @GetMapping("/{userName}")
    public List<Address> findByUserName(@PathVariable("userName") String userName) {
        return addressService.findByUserName(userName);
    }
}